/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package heartinjava;

import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.net.URL;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JLabel;

/**
 *
 * @author TIENDAT
 */

public class Menu extends KhoiTao {
    
    JLabel jlabel;

    Menu(final HeartInJava m_main, final KhungBanCo gui) 
    {
        this.m_Main = m_main;
        this.gui = gui;
    }

    @Override
    public void Enter() 
    {
        gui.container.removeAll();
        URL path = getClass().getResource("resources/bg5.jpg");
        JLabel bg = new JLabel(new ImageIcon(path));
        bg.setBounds(gui.container.getX(), gui.container.getX(), gui.container.getWidth(), gui.container.getHeight());
        gui.container.setBackground(Color.WHITE);
        gui.container.add(bg);
        
        //-- vs comouter
        JButton btnSinglePlayer = new JButton("Single Play!");        
        btnSinglePlayer.setBounds(210, 180, 150, 40);
        btnSinglePlayer.addActionListener(new ActionListener() 
        {
            public void actionPerformed(ActionEvent e) 
            {
                m_Main.SwitchState(KhaiBao.WAIT);
                m_Main.SinglePlay();
            }
        });
        gui.container.add(btnSinglePlayer, 0);

        btnSinglePlayer.addMouseListener(new MouseListener() 
        {
            public void mouseClicked(MouseEvent e) {}
            public void mousePressed(MouseEvent e) {}
            public void mouseReleased(MouseEvent e) {}
            public void mouseExited(MouseEvent e) {}
            public void mouseEntered(MouseEvent e) {}
        });
        gui.repaint();
        
        //--tạo server host
        JButton btnCreateLan = new JButton("Create Lan");
        btnCreateLan.setBounds(370, 180, 150, 40);
        btnCreateLan.addActionListener(new ActionListener() 
        {
            public void actionPerformed(ActionEvent e) 
            {
                m_Main.SwitchState(KhaiBao.CONNECTSERVER);
            }
        });
        gui.container.add(btnCreateLan, 0);

        btnCreateLan.addMouseListener(new MouseListener() 
        {
            public void mouseClicked(MouseEvent e) {}
            public void mousePressed(MouseEvent e) {}
            public void mouseReleased(MouseEvent e) {}
            public void mouseEntered(MouseEvent e) {}
            public void mouseExited(MouseEvent e) {}
        });

        ///-----vào game
        JButton btnJoinGame = new JButton("Join Game");
        btnJoinGame.setBounds(530, 180, 150, 40);
        btnJoinGame.addActionListener(new ActionListener() 
        {
            public void actionPerformed(ActionEvent e) 
            {
                m_Main.SwitchState(KhaiBao.CONNECTCLIENT);    
            }
        });
        gui.container.add(btnJoinGame, 0);

        btnJoinGame.addMouseListener(new MouseListener() 
        {
            public void mouseClicked(MouseEvent e) {}
            public void mousePressed(MouseEvent e) {}
            public void mouseReleased(MouseEvent e) {}
            public void mouseEntered(MouseEvent e) {}
            public void mouseExited(MouseEvent e) {}
        });
        
        ///-----exit
        JButton exit = new JButton("Done");
        exit.setBounds(370, 480, 150, 40);
        exit.addActionListener(new ActionListener() 
        {
            public void actionPerformed(ActionEvent e) 
            {
                System.exit(0);
            }
        });
        gui.container.add(exit, 0);

        exit.addMouseListener(new MouseListener() 
        {
            public void mouseClicked(MouseEvent e) {}
            public void mousePressed(MouseEvent e) {}
            public void mouseReleased(MouseEvent e) {}
            public void mouseEntered(MouseEvent e) {}
            public void mouseExited(MouseEvent e) {}
        });
    }
}
